﻿// Copyright (c) ZhangPeihang. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace LaserMark.Control.Service
{
    public interface IControl : ICard
    {
        /// <summary>
        /// 打开控制器
        /// </summary>
        /// <returns></returns>
        Task<short> Open(short cardNo, short channel, short param);

        /// <summary>
        ///  重置控制器
        /// </summary>
        /// <returns></returns>
        Task<short> Rest(short cardNo);

        /// <summary>
        /// 清除轴状态
        /// </summary>
        /// <returns></returns>
        Task<short> ClearAxisStatus(short cardNo, short axis, short count);

        /// <summary>
        /// 加载配置文件
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        Task<short> LoadConfig(short cardNo, string path);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> ZeroPos(short cardNo, short axis, short count);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> SetPrfJog(short cardNo, short axis, int vel, ref mc.TJogPrm jogPrm);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> SetPTP(short cardNo, short profile, int vel, double pos, ref mc.TTrapPrm trapPrm);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> CloseControl(short cardNo);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> GetAxisStatus(short cardNo, short axis, out int pSts, short count, out uint pClock);

        /// <summary>
        ///
        /// </summary>
        /// <param name="cardNo"></param>
        /// <returns></returns>
        Task<short> SetSoftLimit(short cardNo, short axis, int forward, int reserse);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> GetDi(short cardNo, short diType, out int dValue);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> SetDo(short cardNo, short doType, int dValue);

        /// <summary>
        ///
        /// </summary>
        /// <param name="cardNo"></param>
        /// <param name="doType"></param>
        /// <param name="dValue"></param>
        /// <returns></returns>
        Task<short> SetDoBit(short cardNo, short doType, short doIndex, short dValue);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> AxisOn(short cardNo, short axis);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> AxisOff(short cardNo, short axis);

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        Task<short> Stop(short cardNo, int mask, int count);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="cardNo"></param>
        /// <param name="profile"></param>
        /// <param name="type"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        Task<short> GT_GetPrfMode(short cardNo, short profile, out int type, short count);
    }
}
